package com.lwk.dao.impl;

import java.util.List;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.DetachedCriteria;

import com.lwk.dao.StudentDao;
import com.lwk.domain.Student;

public class StudentDaoImpl extends BaseDaoImpl<Student> implements StudentDao {

	/**
	 * 通过条件获取学生信息
	 * @param dc
	 * @return
	 */
	@Override
	public List<Student> getList(DetachedCriteria dc) {
		List<Student> list = (List<Student>) this.getHibernateTemplate().findByCriteria(dc);
		return list;
	}

	/**
	 * 通过学号获取学生信息
	 * @param dc
	 * @return
	 */
	@Override
	public Student getByStudentNumber(DetachedCriteria dc) {
		List<Student> student = (List<Student>) this.getHibernateTemplate().findByCriteria(dc);
		if (student.size()!=0){
			Student student1 = student.get(0);
			return student1;
		}
		return null;
	}


}
